import requests


# 信息
def get_xjxx_dict(Cookie):
    xjxx_post_header = {"Cookie": Cookie}
    xjxx_url = "http://jwcxk2.aufe.edu.cn/student/rollManagement/rollInfo/index"
    try:
        xjxx_url_text = requests.get(xjxx_url, headers=xjxx_post_header).text
        temp_1 = xjxx_url_text.split("<!-- 查询条件开始2 -->")[1].split("<!-- 表单结束 -->")[0].split(
            "<div class=\"profile-info-row\">")
        temp_dict = {}
        for i in temp_1:
            if '<div class="profile-info-name">' in i:
                temp_i_1 = i.split('<div class="profile-info-name">')
                for o in temp_i_1:
                    if '</div>' in o:
                        temp_o_key = o.split("</div>")[0]
                        temp_o_value = o.split('">')[1].split('</div>')[0]
                        temp_dict[temp_o_key] = temp_o_value

        for i in temp_dict.keys():
            temp_value = temp_dict[i]
            temp_value = ''.join(
                ''.join(''.join(''.join(list(set(temp_value.split(' ')))).split('\r')).split('\n')).split('\t'))
            if temp_value == '':
                temp_dict[i] = "null"
            else:
                temp_dict[i] = temp_value
            # '证件号码': 'style="cursor:pointer;"title="点击显示全部"onclick="showSfzh(\'34240119991014541X\',\'0\');<a',
            if i == '证件号码':
                temp_dict[i] = temp_dict[i].split("showSfzh(\'")[1].split("\',")[0]
        return temp_dict
    except:
        return {"info": "error"}
